<?php
namespace app\admin\logic;


//订单页
use think\facade\Request;

class OrderLogic{
    //订单页的where条件拼接
     public static function  orderWhere(){
         $param=Request::param();
         $where=[];
         if (isset($param['keywords']) && !empty($param['keywords'])){
             $where[]=['o.order_sn','like','%'.$param['keywords'].'%'];
         }
         if (isset($param['mintime']) && !empty($param['mintime'])){
             $where[]=['o.add_time','>',strtotime($param['mintime'])];
         }
         if (isset($param['maxtime']) && !empty($param['maxtime'])){
             $where[]=['o.add_time','<',strtotime($param['maxtime'])];
         }
         if (isset($param['minmoney']) && !empty($param['minmoney'])){
             $where[]=['o.goods_amount','>',$param['minmoney']];
         }
         if (isset($param['maxmoney']) && !empty($param['maxmoney'])){
             $where[]=['o.goods_amount','<',$param['maxmoney']];
         }
         if (isset($param['status']) && !empty($param['status'])){
             $where[]=['o.status','in',$param['status']];
         }

         return $where;
     }

      public static function   orderData(){
          $param=Request::param();
          $data=[
              'keywords'=>isset($param['keywords'])?$param['keywords']:'',
              'mintime'=>isset($param['mintime'])?$param['mintime']:'',
              'maxtime'=>isset($param['maxtime'])?$param['maxtime']:'',
              'maxmoney'=>isset($param['maxmoney'])?$param['maxmoney']:'',
              'minmoney'=>isset($param['minmoney'])?$param['minmoney']:'',
              'status'=>isset($param['status'])?$param['status']:[],

          ];

          return $data;


          }


}